import { defineStore } from "pinia"
import { ref } from 'vue'

export const useTokenStore = defineStore(
    'token',
    () => {
        //定义token
        const token = ref('')

        //设置token的值
        function setToken (newToken: any) {
            token.value = newToken
        }

        //移除token的值
        function removeToken () {
            token.value = ''
        }

        return {
            token, setToken, removeToken
        }
    },
    {
        persist: true,
    }
)